package com.egdd.video.service.iml;

import com.egdd.video.mbg.mapper.UserMapper;
import com.egdd.video.mbg.model.User;
import com.egdd.video.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements IUserService {
    @Autowired(required = false)
    UserMapper userMapper;

    @Override
    public int addUser(User user) {
        return userMapper.insert(user);
    }

    @Override
    public int delUserById(Integer id) {
        return userMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int updateUserInfo(Integer id, User user) {
        user.setId(id);
        return userMapper.updateByPrimaryKey(user);
    }

    @Override
    public int replaceUserInfo(User user) {
        return userMapper.updateByPrimaryKey(user);
    }
}
